package com.demoworld;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

/**
 * Created by li_wb on 2018/3/3.
 */
@Component
public class ContextHolder2 implements ApplicationContextAware {
    private static ApplicationContext ctx;

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        ContextHolder2.ctx = applicationContext;
    }

    public ApplicationContext getCtx() {
        return ctx;
    }
}
